import java.sql.SQLOutput;
import java.util.Scanner;

public class Test2 {

    public static void main4(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            int index = str.lastIndexOf(' ');
            String tmp = str.substring(index+1);
            System.out.println(tmp.length());
        }
    }
    public static void main3(String[] args) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("123");
        System.out.println(stringBuilder);

        StringBuffer stringBuffer = new StringBuffer("yxj");
        stringBuffer.append("111");
        String ret = stringBuilder.toString();
        System.out.println(ret);
/*        StringBuffer stringBuffer = new StringBuffer("hello");
        stringBuffer.insert(1,"22");
        System.out.println(stringBuffer);
        stringBuffer.delete(1,3); //[1,3)
        System.out.println(stringBuffer);
        System.out.println(stringBuffer.reverse());
        String str = stringBuffer.toString();
        System.out.println(str);*/
    }
    public static void main2(String[] args) {
        String s = "hello";
        s += " world";
        System.out.println(s); // 输出：hello world

        System.out.println("===========");
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("hello ");
        stringBuilder.append("world");
        String ret = stringBuilder.toString();
        System.out.println(ret);
    }

    public static void main1(String[] args) {
        long start = System.currentTimeMillis();
        String s = "";
        for(int i = 0; i < 10000; ++i){
            s += i;
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);
        start = System.currentTimeMillis();
        StringBuffer sbf = new StringBuffer("");
        for(int i = 0; i < 10000; ++i){
            sbf.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println(end - start);
        start = System.currentTimeMillis();
        StringBuilder sbd = new StringBuilder();
        for(int i = 0; i < 10000; ++i){
            sbd.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println(end - start);
    }
}
